<template>
    <tm-modal :btnRound="6" hideCancel :overlayClick="false" ref="modal" color="white" okColor="#A37C3D"
        cancelColor="#A37C3D" okLinear="left" splitBtn title="提示" content="请先完善个人信息，才能使用此功能，点击确定跳转"></tm-modal>
</template>
<script setup lang="ts">
    import { onMounted, computed, ref } from 'vue';
    import { useUserStore } from "/stores/user.ts";
    import { useRouter } from 'vue-router';
    import { isEmpty } from "lodash";
    import { switchTab } from '/utils/index.ts'
    import { pageLink } from '/constants/link.ts'
    const userStore = useUserStore();

    const modal = ref(null);

    const isPersonalInfo = computed(() => {
        return !isEmpty(userStore.userInfo)
    })

    const handleUserVaild = () => {
        if (isPersonalInfo.value) return
        modal.value?.open()
            ?.then(() => {
                switchTab(pageLink.index)
            })
    }

    defineExpose({ handleUserVaild })
</script>
<style lang="less" scoped></style>